import axiosRequest from "@/api/axiosRequest.ts";

const BaseUrl = '/admin/role'

const getRoleDetail = (id: number) => axiosRequest({
    url: BaseUrl + '/detail',
    method: 'GET',
    params: {
        id: id
    }
})

const addRole = (data: Role) => axiosRequest({
    url: BaseUrl + '/add',
    method: 'POST',
    data: data
})

const updateRole = (data: Role) => axiosRequest({
    url: BaseUrl + '/update',
    method: 'PUT',
    data: data
})

const deleteRole = (id: number) => axiosRequest({
    url: BaseUrl + '/delete',
    method: 'DELETE',
    params: {
        id: id
    }
})

export const roleApi = {
    getRoleList: () => axiosRequest.get(BaseUrl + '/list'),
    getRoleDetail,
    addRole,
    updateRole,
    deleteRole
}